class SceneEnd extends GuaScene {
    constructor(game) {
        super(game)
        self.game = game

        this.game.scene = this
        this.setUp()
        this.setInputs()

    }
    setUp() {
        // this.particles = GuaParticleSystem.new(this.game)
        // this.addElement(this.particles)
        var ground = new Ground(this.game)
        this.ground = ground
        this.addElement(ground)
        var gameOver = new GuaImage(this.game, 'gameOver')
        gameOver.setPosition(50, 200)
        this.addElement(gameOver)
    }

    addElements(bg, pipe, bird, ground){
        this.bg = bg
        this.addElement(bg)

        this.pipe = pipe
        this.addElement(pipe)

        this.ground = ground
        this.addElement(ground)

        this.bird = bird
        bird.rotation = 45
        this.addElement(bird)

        this.setUp()
    }

    setInputs() {
        var self = this
        // self.game.registerAction('d', function(keyStatus) {
        //     self.bird.run(+9, keyStatus)
        // })
        // self.game.registerAction('a', function(keyStatus) {
        //     self.bird.run(-7, keyStatus)
        // })
        self.game.registerAction('k', function(keyStatus) {
            let title = new SceneTitle(self.game)
            self.game.addScene('title', title)
            self.game.runWithScene('title')
        })
    }

    draw() {
        super.draw()
            // this.game.context.strokeText('开始游戏', 20, 250)
    }

    update() {
        log("scene ,kkupdate")
        super.update()
    }
}